<?php

namespace App\Console;

use App\Console\Commands\ScheduleImage;
use App\Console\Commands\ScheduleQueryImage;
use App\Console\Commands\ScheduleQueryVideo;
use App\Console\Commands\ScheduleVideo;
use App\Console\Commands\SyncAdvertiser;
use App\Console\Commands\SyncImage;
use App\Console\Commands\SyncVideo;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        SyncAdvertiser::class,
        SyncImage::class,
        SyncVideo::class,
        ScheduleImage::class,
        ScheduleVideo::class,
        ScheduleQueryImage::class,
        ScheduleQueryVideo::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('sync:advertiser')->dailyAt('00:00')->timezone('Asia/Shanghai')->withoutOverlapping();

        $schedule->command('sync:image')->hourly()->timezone('Asia/Shanghai')->withoutOverlapping();
        $schedule->command('sync:video')->hourly()->timezone('Asia/Shanghai')->withoutOverlapping();

        $schedule->command('schedule:image')->everyFiveMinutes()->timezone('Asia/Shanghai')->withoutOverlapping();
        $schedule->command('schedule:video')->everyFiveMinutes()->timezone('Asia/Shanghai')->withoutOverlapping();

        $schedule->command('schedule:queryImage')->everyTenMinutes()->timezone('Asia/Shanghai')->withoutOverlapping();
        $schedule->command('schedule:queryVideo')->everyTenMinutes()->timezone('Asia/Shanghai')->withoutOverlapping();



    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
